<?php
// breadcrumbs
$this->breadcrumbs=array(
    'Widgets'=>array('index'),
    $widget->name=>array('/Cms/admin/widget/update','id' => $widget->id),
    'Manage Instances'=>array('/Cms/admin/widgetData','WidgetData[widget_id]' => $widget->id),
);
$cs = Yii::app()->clientScript;

if (is_object($widgetData))
{
    $this->breadcrumbs[$widgetData->name] = array('/Cms/admin/widget/updateInstance','id' => $widget->id,'instanceId'=>$widgetData->id);
    $this->breadcrumbs[] = 'Update';
}
else
    $this->breadcrumbs[] = 'New instance';


$tabs = array('Content'=>$this->renderPartial('_editorForm', array(
    'widget'=>$widget,
    'attributes'=>$attributes,
    'config'=>$config,
    'isNew'=>!is_object($widgetData),
    'container'=>$container,
), true));

if (!is_object($widgetData))
{
?>
<style type="text/css">
.scroll-content-item { width: 230px; height: 260px; float: left; margin: 10px; text-align: center; }
* html .scroll-content-item { display: inline; } /* IE6 float double margin bug */
.scroll-content-item .wrapper-img {
    background: url("/themes/Admin/images/thumb-border-230x190.jpg") no-repeat scroll 0 0 transparent;
    float: left;
    height: 220px;
    list-style: none outside none;
    width: 230px;
}
.scroll-content-item .name {text-align: center; font-size: 12px;}
.scroll-content-item a.img {
    display: table-cell; vertical-align: middle; height: 218px; width: 230px; text-align: center;
}
.scroll-content-item a img {border: medium none;}
</style>
<?php
    if ($currentLayoutId)
    {
        $tabs['Layouts'] = $this->widget('zii.widgets.CListView', array(
            'id'=>'layouts',
            'dataProvider'=>$layouts,
            'viewData'=>array('selected'=>$currentLayoutId),
            'itemView'=>'_layout_item',
            'template'=>'{items}',
        ), true).'<div style="clear:both;"></div>';
    }
    if ($widget->type != WidgetDefinition::TYPE_STATIC) 
        $tabs['Page'] = CHtml::checkBoxList('pages',array_keys($pagesUsed),$pagesUsed, array('class'=>'page_widget_id')).'<div class="hint">Your changes will affect selected pages.</div>';
}

// render HTML
$this->widget('zii.widgets.jui.CJuiTabs', array(
    'tabs'=>$tabs,
));
?>